package com.chenxi.controller;

import com.ganyu.domain.ResponseResult;
import com.ganyu.domain.entity.User;
import com.ganyu.service.impl.UserLoginServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * DATA: 2022/9/15
 * Author: 晨夕
 */
@RestController
public class UserLoginController {

    @Autowired
    private UserLoginServiceImpl userLoginServiceImpl;

    //登录接口
    @PostMapping("/login")
    public ResponseResult<User> login(@RequestBody User user){
        return userLoginServiceImpl.login(user);
    }
    //退出接口
    @PostMapping("/logout")
    public ResponseResult<User> logout(){
        return userLoginServiceImpl.logout();
    }
}
